package AudioUDP.Sender;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;

public class SenderDown extends Thread{
/**
 * Cette classe permet la lecture des paquets de contrôle de flux UDP
 */
	DatagramPacket inPacket = null;
	DatagramSocket datagramSocket = null;
	byte [] buf = new byte[640];
	boolean isOk;

	
	SenderDown(DatagramSocket dtSock,boolean bool){
		datagramSocket = dtSock;
		isOk= bool;
	}
	
	public void start(){
		while(true){
			try {
				inPacket = new DatagramPacket(buf, buf.length);
				datagramSocket.receive(inPacket);
				isOk=!isOk;
				System.out.println(isOk);
				notifyAll();
			
			} catch (IOException e) {
				
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			
		}
		
	}


	  public synchronized void setisOK(){
	    	isOk=!isOk;
	    }
}
